local guicai = fk.CreateSkill{
    name = "hs__guicai",
}

guicai:addEffect(fk.AskForRetrial, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(guicai.name) and not player:isNude()
    end,
    on_cost = function(self, event, target, player, data)
      local room = player.room
      local ids = table.filter(table.connect(player:getHandlyIds(), player:getCardIds("e")), function (id)
        return not player:prohibitResponse(Fk:getCardById(id))
      end)
      local card = room:askToCards(player,{
        min_num = 1,
        max_num = 1,
        skill_name = guicai.name,
        pattern = tostring(Exppattern{ id = ids }),
        prompt = "#hs__guicai-ask::"..target.id..":"..data.reason,
        include_equip = true,
        cancelable = true,
      })
      if #card > 0 then
        event:setCostData(self,{cards = card})
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
      player.room:changeJudge{
        card = Fk:getCardById(event:getCostData(self).cards[1]),
        player = player,
        data = data,
        skill_name = guicai.name,
        response = true,
      }
    end,
  })

Fk:loadTranslationTable{
  ["hs__guicai"]="鬼才",
  [":hs__guicai"] = "当判定结果确定前，你可打出一张牌代替之。",
  ["#hs__guicai-ask"] = "是否发动 鬼才，打出一张牌代替 %dest 的 %arg 判定",

  ["$hs__guicai1"] = "天命难违？哈哈哈哈哈……",
  ['$hs__guicai2'] = "才通天地，逆天改命！",
}

return guicai